<template>
  <view class="dynamic-details">
    <RcNavigation title="动态列表" border />
    <view class="section" v-if="list.length">
      <view v-for="item in list" :key="item.id" class="card flex"
        :data-url="'/pages/dynamic-details/dynamic-details?id=' + item.id" @click="goto">
        <image class="cover" :src="item.cover" mode="aspectFill" />

        <view class="flex-1 flex-d-sb  m-l20">
          <text class="text-700-130">{{ item.title }}</text>
          <text class="text-400-128 m-t10">{{ item.intro }}</text>
        </view>
      </view>
    </view>
    <up-empty v-else mode="list"></up-empty>
  </view>
</template>
<script lang="ts" setup>
import { ref } from 'vue'
import { onLoad, onShow } from '@dcloudio/uni-app'
import RcNavigation from '@/components/navigation.vue'
import { useNavigator } from '@/hooks/use-navigator'
const list = ref([])
async function getList(id: string) {
  const res = await uni.$u.get("/dongtai/lst", { type: id })
  list.value = res.data
}
onLoad((e) => {
  getList(e.id)
})
const { goto } = useNavigator()
</script>
<style lang="scss" scoped>
.section {
  padding: 0 20rpx;
  border-radius: 20rpx;
  background-color: $bg-color-1;

  .card {
    height: 190rpx;
    border-bottom: 1rpx solid $border-color-4;

    &:last-child {
      border: none;
    }

    .cover {
      width: 148rpx;
      height: 148rpx;
      border-radius: 10rpx;
      border: 1rpx solid $border-color-4;
    }
  }
}
</style>